package com.example.algorithmdemo;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

public class BlankFragment extends Fragment implements View.OnClickListener{

    private View view;
    private Button button;
    private TextView textV;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (view == null){
            view =  inflater.inflate(R.layout.fragment_blank, container, false);
        }
        button = view.findViewById(R.id.btn);
        button.setOnClickListener(this);
        textV = view.findViewById(R.id.textV);
        return view;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.btn:
                textV.setText("hello");
                break;
        }
    }
}